﻿#include "stdafx.h"

using namespace System;
using namespace System::Text;
using namespace System::Collections::Generic;
using namespace	Microsoft::VisualStudio::TestTools::UnitTesting;

namespace TestProject1
{
	[TestClass]
	public ref class MockProbabilityModelTests
	{
	public: 
		[TestMethod]
		void countTest()
		{
			MockProbabilityModel model("arytmetyka", strlen("arytmetyka"));
			Assert::AreEqual<int>(10, model.getAllSymbolsCount());
		}

		[TestMethod]
		void lowerBoundsTest()
		{
			MockProbabilityModel model("arytmetyka", strlen("arytmetyka"));
			Assert::AreEqual<int>(0, model.getLowerBoundForSymbol('a'), "Wrong bound for a");
			Assert::AreEqual<int>(2, model.getLowerBoundForSymbol('e'), "Wrong bound for e");
			Assert::AreEqual<int>(3, model.getLowerBoundForSymbol('k'), "Wrong bound for k");
			Assert::AreEqual<int>(4, model.getLowerBoundForSymbol('m'), "Wrong bound for m");
			Assert::AreEqual<int>(5, model.getLowerBoundForSymbol('r'), "Wrong bound for r");
			Assert::AreEqual<int>(6, model.getLowerBoundForSymbol('t'), "Wrong bound for t");
			Assert::AreEqual<int>(8, model.getLowerBoundForSymbol('y'), "Wrong bound for y");
		}

		[TestMethod]
		void upperBoundsTest()
		{
			MockProbabilityModel model("arytmetyka", strlen("arytmetyka"));
			Assert::AreEqual<int>(2, model.getUpperBoundForSymbol('a'), "Wrong bound for a");
			Assert::AreEqual<int>(3, model.getUpperBoundForSymbol('e'), "Wrong bound for e");
			Assert::AreEqual<int>(4, model.getUpperBoundForSymbol('k'), "Wrong bound for k");
			Assert::AreEqual<int>(5, model.getUpperBoundForSymbol('m'), "Wrong bound for m");
			Assert::AreEqual<int>(6, model.getUpperBoundForSymbol('r'), "Wrong bound for r");
			Assert::AreEqual<int>(8, model.getUpperBoundForSymbol('t'), "Wrong bound for t");
			Assert::AreEqual<int>(10, model.getUpperBoundForSymbol('y'), "Wrong bound for y");
		}

		[TestMethod]
		void countTest1()
		{
			MockProbabilityModel model("arytmetyka", strlen("arytmetyka"), 1);
			Assert::AreEqual<int>(80, model.getAllSymbolsCount());
		}

		[TestMethod]
		void lowerBoundsTest1()
		{
			MockProbabilityModel model("arytmetyka", strlen("arytmetyka"), 1);
			Assert::AreEqual<int>(0, model.getLowerBoundForSymbol(0), "Wrong bound for 0");
			Assert::AreEqual<int>(38, model.getLowerBoundForSymbol(1), "Wrong bound for 1");
		}

		[TestMethod]
		void upperBoundsTest1()
		{
			MockProbabilityModel model("arytmetyka", strlen("arytmetyka"), 1);
			Assert::AreEqual<int>(38, model.getUpperBoundForSymbol(0), "Wrong bound for 0");
			Assert::AreEqual<int>(80, model.getUpperBoundForSymbol(1), "Wrong bound for 1");
		}
	};
}
